package com.noahsloan.groovy.algorithms

/**
 * @author noah
 *
 */
public class Edge extends Expando {
	
	Edge(Map props = [:]) {
		super(props)
	}
	
    def remove() {
		start.outgoing.remove(this)
		end.incoming.remove(this)
    }
    
    boolean equals(it) {
    	start?.equals(it.start) && end?.equals(it.end)
    }
    
    int hashCode() {
    	start?.hashCode() * 31 + end?.hashCode() as int
    }
    
    String toString() {
		"${start} -> ${end}"
	}
	
}
